package com.levi.method;

/**
 * @author shentong
 * @date 2022/1/10 8:42 PM
 * @description
 */
public class Demo {
    public static void main(String[] args) {
        DemoService demoService = new DemoServiceImpl();
        System.out.println(demoService.defaultMethod());//调用默认方法
        System.out.println(demoService.abstractMethod());//调用抽象方法
        System.out.println(DemoService.staticMethod());//调用接口中的静态方法

        //重写接口中的默认方法和静态方法
        DemoService demoService1 = new DemoService() {
            @Override
            public String abstractMethod() {
                return "overwrite abstractMethod";
            }

            @Override
            public String defaultMethod() {
                return "overwrite default method";
            }
        };
        System.out.println(demoService1.abstractMethod());
        System.out.println(demoService1.defaultMethod());
    }
}
